﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;

namespace LuZhouLaoJiao
{
    public partial class InquiryInput : Form
    {
        public InquiryInput()
        {
            InitializeComponent();
            this.toolTip1.SetToolTip(this.btnSearch, "搜索");
            this.toolTip1.SetToolTip(this.cbNotClose, "搜索时不关闭此窗口.");
            this.toolTip1.SetToolTip(this.tbPici, "格式: “20130510”");
            this.toolTip1.SetToolTip(this.tbSuandu, "格式: “6.7” 或者 “6.7,7.3”");
            this.toolTip1.SetToolTip(this.tbJianceren, "格式: “admin”");
            this.toolTip1.SetToolTip(this.tbLaiyuan, "格式: “3号车间”");
            this.toolTip1.SetToolTip(this.tbRiqi, "格式: “2013-05-10” 或 “2013-05-10, 2013-06-01”");
            this.toolTip1.SetToolTip(this.tbRemark, "格式: “酸度较低”");
        }

        private void btnSearch_Click(object sender, EventArgs e)
        {
            Regex regexSuandu = new Regex(@"^[0-9,，.]+$");
            Regex retexRiqi = new Regex(@"^[0-9,，.]");
            if (tbSuandu.Text.ToString() != "" && !regexSuandu.IsMatch(tbSuandu.Text.ToString()))
            {
                MessageBox.Show("请指定适当的酸度范围.");
                return;
            }

            if (tbRiqi.Text.ToString() != "" && !retexRiqi.IsMatch(tbRiqi.Text.ToString())) 
            {
                MessageBox.Show("请指定适当的日期范围.");
                return;
            }
            if (!cbNotClose.Checked)
            {
                //MessageBox.Show("不可见");
                this.Visible = false;
            }
            InquiryResult searchResult = new InquiryResult();
            searchResult.ShowDialog(this);

            
            //this.Visible = false;
            //在InquiryResult中关闭
        }
    }
}
